#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>
int arr[505];
int sign[505];
int res[505];
int now[505];
int main()
{
	int P;
	int ws; int i, j;
	scanf("%d", &P);
	ws = P * log10(2) + 1;
	sign[0] = 2;
	res[0] = 0;
	now[0] = 1;
	while (P > 0) {
		if (P & 1) {
			for (i = 0; i <= 500; i++) {
				for (j = 0; j <= 500; j++) {
					if (i + j <= 500)
						res[i + j] += now[i] * sign[j];
				}
			}
			for (i = 0; i <= 500; i++) {
				if (res[i] > 9) {
					res[i + 1] += res[i] / 10;
					res[i] %= 10;
				}
			}
			for (i = 0; i <= 500; i++) {
				now[i] = res[i];
				res[i] = 0;
			}
		}
		for (i = 0; i <= 500; i++) {
			for (j = 0; j <= 500; j++) {
				if (i + j <= 500)
					arr[i + j] += sign[i] * sign[j];
			}
		}
		for (i = 0; i <= 500; i++) {
			if (arr[i] > 9) {
				arr[i + 1] += arr[i] / 10;
				arr[i] %= 10;
			}
		}
		for (i = 0; i <= 500; i++) {
			sign[i] = arr[i];
			arr[i] = 0;
		}
		P >>= 1;
	}
	now[0]--;
	printf("%d\n", ws);
	for (i = 499,j=0; i >= 0; i--) {
		printf("%d", now[i]);
		j++;
		if (j >= 50) {
			printf("\n");
			j = 0;
		}
	}
	return 0;
}